package com.lagou.dubbo;

import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

/**
 * description: providerB启动类
 *
 * @author ykl
 * @version V1.0
 * @date 2020/9/8 下午4:40
 */
@SpringBootApplication(scanBasePackages = {"com.lagou.dubbo"})
public class ProviderBApiApplication {


    public static void main(String[] args) {
        SpringApplication.run(ProviderBApiApplication.class, args);
    }

    @Configuration
    @EnableDubbo(scanBasePackages = "com.lagou.dubbo.service.impl")
    @PropertySource("classpath:/dubbo-provider.properties")
    static  class  ProviderConfiguration{
        @Bean
        public RegistryConfig registryConfig(){
            RegistryConfig  registryConfig  = new RegistryConfig();
            registryConfig.setAddress("zookeeper://127.0.0.1:2181?timeout=10000");
            return   registryConfig;
        }
    }
}
